#include <iostream>

using namespace std;


void calc4(){
double* csigs = new double[5];
double* nsigs = new double[5];
double* cconc = new double[5];
double* nconc = new double[5];
double* fb = new double[5];
double* fc = new double[5];
double* fn = new double[5];
double* xc = new double[5];
double* xn = new double[5];

double ccor = 1;
double ncor = 3.5;
double tolerance = 0.2 * 1.00000001;
double incr = 0.04;

double mixcsig,mixnsig;

for(int i = 0; i < 5; i++){
    csigs[i] = csigs[i] + ccor;
    nsigs[i] = nsigs[i] + ncor;
}



for(fb[0] = 0; fb[0] <= 1; fb[0] += incr){
    for(fb[1] = 0;fb[1] <= 1 - fb[0]; fb[1]+=incr){
        for(fb[2] = 0; fb[2] <= (1-fb[0]-fb[1]);fb[2]+=incr){
            for(fb[3]=0; fb[3]<= (1-fb[0]-fb[1]-fb[2]);fb[2]+=incr){
                fb[4] = 1-fb[0]-fb[1]-fb[2]-fb[3];
                cout.setf( ios_base::fixed, ios_base::floatfield );
                cout.precision(3);


                for(int i = 0; i < 5;i++){
                    xc[i] = fb[i]*cconc[i];
                    xn[i] = fb[i]*nconc[i];
                }

                double xctotal = xc[0]+xc[1]+xc[2]+xc[3]+xc[4];
                double xntotal = xn[0]+xn[1]+xn[2]+xn[3]+xn[4];

                for(int i = 0; i < 5;i++){
                    fc[i] = xc[i]/xctotal;
                    fn[i] = xn[i]/xntotal;
                    cout << xctotal << endl;
                }

                double predcsig = fc[0]*csigs[0] + fc[1]*csigs[1] + fc[2]*csigs[2] + fc[3]*csigs[3] + fc[4]*csigs[4];
                double prednsig = fn[0]*nsigs[0] + fn[1]*nsigs[1] + fn[2]*nsigs[2] + fn[3]*nsigs[3] + fn[4]*nsigs[4];

                double errorc = predcsig-mixcsig;
                double errorn = prednsig-mixnsig;


            }

        }
    }
}

}
int main()
{

    calc4();

    return 0;
}



